<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 6,  随机给出一个10位以内的数，然后输出该数共有多少位，并将每位的数字保存到数组中. 
    //     如:1342, 位数为:4, 数组为:[1,3,4,2]
    var num=Math.floor(Math.random()*9999999999)+1;
    var a6=[];
    while(num){
        a6.unshift(num%10);
        num=parseInt(num/10);
    }
    console.log(num);
    console.log("位数为:"+a6.length);
    console.log(a6);
    </script>
</body>
</html>